package com.bjc.chapter13;

/**
 *
 */
public class StringTest1 {

    public static void main(String[] args) {
        test1();
    }

    public static void test1() {
        //字面量定义的方式 "abc"存储在字符串常量池中
        String s1 = "abc";
        String s2 = "abc";
//        s1 = "hello";

        System.out.println(s1 == s2);
        System.out.println(s1);
        System.out.println(s2);
    }

    public static void test2(){
        String s1 = "abc";
        String s2 = "abc";
        s2+="def";
        System.out.println(s2);
        System.out.println(s1);
    }

    public static void test3(){
        String s1 = "abc";
        String s2 = s1.replace("a", "m");
        System.out.println(s1); //abc
        System.out.println(s2); //mbc
    }
}
